<?php

include("db.inc");

$name =  $_POST["name"];
$email =  $_POST["email"];
$pass =  $_POST["pass1"];

mysql_query("INSERT INTO users (username, password, email) VALUES ('".$name."','".$pass."', '".$email."')");
$result = mysql_query("SELECT id FROM users WHERE email ='".$email."'");

while($row = mysql_fetch_array($result))
{
	$_SESSION['User']['id'] = $row['id'];
}

mysql_close($con);

$_SESSION['User']['name'] = $name;
$_SESSION['User']['pass'] = $pass;
$_SESSION['User']['email'] = $email;

header('Location: index.php?page=profile.php');
?>